<template>
  <el-select v-model="value" placeholder="请选择角色">
    <el-option v-for="item in roles" :key="item.id" :label="item.name" :value="item.id" />
  </el-select>
</template>
<script setup lang="ts">
import { ref, onMounted, defineModel } from 'vue';
import { ElSelect } from 'element-plus';
import { getRoleAsync } from '@/utils/api/user/index';
import type { RoleDto } from '@/utils/api/role/type';
const roles = ref<Array<RoleDto>>([]);
const value = defineModel<string>();
onMounted(async () => {
  const res = await getRoleAsync();
  roles.value = res;
});
</script>

<style lang="scss" scoped></style>
